# from selenium import webdriver
# driver = webdriver.Edge()
# driver.get("http://www.baidu.com")
# driver.close()
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.options import Options
from selenium import  webdriver
from time import sleep
driver = webdriver.Chrome()
# driver = webdriver.Firefox()
driver.get("http://baidu.com")
sleep(4)
driver.find_element(By.ID,'kw').send_keys("霉霉")
sleep(2)
button = driver.find_element(By.ID,'su')
print(button.get_attribute("value"))
print(button.size)
button.submit()
driver.get_screenshot_as_file('aa.png')
driver.back()
sleep(20)
driver.forward()
assert_text = driver.find_element(By.LINK_TEXT,"百度首页").text
print(assert_text)
assert assert_text == "百度首页","异常文本，查询失败"
sleep(10)
driver.close()
# sleep(7)
# driver.find_element(By.ID,'result_logo').click()
# driver.find_element(By.CSS_SELECTOR,'#hotsearch-content-wrapper > li:nth-child(1) > a').click()
# sleep(10)
# driver.find_element(By.XPATH,'//*[@id="result_logo"]/img[1]').click()
# sleep(20)
# driver.close()
# driver.get("http://qq.com")
# sleep(10)
# driver.find_element(By.XPATH,'//*[@id="qqhome-channel-header"]/div/div/div/ul/li[9]/a').click()
# driver.find_element(By.XPATH,'//*[@id="qqhome-channel-header"]/div/div/div/ul/li[3]/a').click()
# driver.find_element(By.XPATH,'')

sleep(10)
driver.refresh()
sleep(1000)